/*
 * Copyright 2025 arisgo@163.com
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package com.arisgo.cloud.auth.sys.api;

import com.arisgo.cloud.auth.sys.service.TenantUserService;
import com.arisgo.cloud.auth.sys.vo.TenantUserVo;
import com.arisgo.cloud.common.Result;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.AllArgsConstructor;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * 租户功能 Api
 *
 * @author Arisgo
 * @since 2024-06-14
 */
@RestController
@AllArgsConstructor
@Tag(name = "租户用户关联 API")
public class TenantUserApi {

    private final TenantUserService tenantUserService;

    /**
     * 依id查询租户功能
     */
    @GetMapping(value = "/tenant/user/{userId}")
    @Operation(summary = "依id查询")
    public Result<List<TenantUserVo>> findTenantByUserId(@PathVariable(value = "userId") Long userId) {
        return Result.success(tenantUserService.findTenantByUserId(userId));
    }

}
